package util;

import structures.*;


public class Synth {
	public static final int MAX_SUBGRAPH_SIZE = 6;
	public static final double LINK_PROB = .3;
	public static final int MAX_TIME_GAP = 6;
	public static final Date startDate = new Date(1, 0, 2010);
	public static final Date endDate = new Date(1, 0, 2011);
	public static final int OCCUR = 100;
	
	public static DynamicGraph generateSynthetic() {
		DynamicGraph graph = new DynamicGraph();
		StaticGraph g = generateRandomSubgraph();
		StaticGraph gPrime = generateRandomSubgraph();
		int timeGap = (int) (Math.random() * MAX_TIME_GAP);
		
		System.out.println(g);
		System.out.println(gPrime);
		
		for(int i = 0; i < 20; i++) {
			Date d = Date.getRandomDate(startDate, endDate);
			graph.add(g, d);
			graph.add(gPrime, d.add(timeGap));
		}
		
		return graph;
	}
	
	public static StaticGraph generateRandomSubgraph() {
		int size = ((int) (Math.random() * (MAX_SUBGRAPH_SIZE-1))) + 1;
		StaticGraph result = new StaticGraph();
		result.addNode("foo");
		for(int i = 0; i < size - 1; i++) {
			result.addSymLink(Math.random() + "", result.getRandomNode());
		}
		return result;
	}
	
	public static void main(String[] args) {
		DynamicGraph g = generateSynthetic();
		Date d = new Date(startDate);
		for(int i = 0; i < 365; i++) {
			d = d.nextDay();
			System.out.println(d);
			System.out.println(g.getDay(d));
		}
	}
	
}
